[#assign dict = {"1" : "是", "0" : "否"}]
<div class="panel panel-info panel-content" >
        <div class="panel-heading">
            <form id="soform" method="post" style="display: inline-block;">
                <input type="hidden" name="so_channelId" value="${so_channelId!}">
                <table>
                    <tr>
                        <td class="w80">
                            <label class="center-block">发布时间：</label>
                        </td>
                        <td style="width: 250px;">
                            <input class="form-control Wdate" name="so_sdate" id="so_sdate" value="${so_sdate!}" readonly style="display: inline-block; width:110px;" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'so_edate\')}'})"  > -
                            <input class="form-control Wdate" name="so_edate" id="so_edate" value="${so_edate!}" readonly style="display: inline-block; width:110px;" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'so_sdate\')}'})" >
                        </td>
                        <td>
                            <div class="input-group" style="margin-left: 5px;">
                                <input type="text" class="form-control"  name="so_title"  value="${so_title!}" placeholder="标题">
                                <span class="input-group-btn">
									<button class="btn btn-default" type="button" onclick="search()">搜索</button>
								</span>
                            </div>
                        </td>
                    </tr>
                </table>
            </form>

			<span style="float: right;">
			  <button type="button" class="btn btn-info" id="addButton" onclick="addRole();">
				<span class="glyphicon glyphicon-"></span>&nbsp;新增
			  </button>
			  <button type="button" class="btn btn-danger" id="batchDeleteButton" onclick="deleteMore();">
				<span class="glyphicon glyphicon-minus"></span>&nbsp;批量删除
			  </button>
			</span>
        </div>
        <!-- Table -->
        <table class="table table-bordered table-hover table-striped">
          <thead>
            <tr>
              <th width="50" ><input type="checkbox" class="check_all" /></th>
              <!-- <th width="80" >序号</th> -->
              <th style="text-align: center" width="400">标题</th>
              <th style="text-align: center" width="50">排序号</th>
              <th style="text-align: center" width="80">浏览次数</th>
              <th style="text-align: center" width="120">创建时间</th>
              <th style="text-align: center" width="70">是否推荐</th>
              <th style="width:150px;"  >操作</th>
            </tr>
          </thead>
          <tbody class="retbody">
          	[#list p.list as content]
          		<tr>
          			<td align="center"><input type="checkbox" _rep="${content.id!}"/></td>
          			<!-- <td align="center">${content_index+1}</td> -->
	          		<td align="left">${content.title!}</td>
	          		<td align="center">${content.seq!}</td>
	          		<td align="center">${content.hit!}</td>
	          		<td align="center">[#if content.createtime??]${content.createtime?datetime}[/#if]</td>
	          		<td align="center">${dict[content.ifRecommend?string]!}</td>
	          		<td align="center">
		          		<button type="button" class="btn btn-info btn-xs edits" onclick="edit(${content.id})">编辑</button>
		          		<button type="button" class="btn btn-danger btn-xs delbtn" onclick="del(${content.id})">删除</button>
	          		</td>
	          	<tr>
          	[/#list]
          </tbody>
        </table>
       <div class="panel-footer" >[@fenye p = p form = 'contentForm' mulity = 'content'/]</div>
      </div>

<!-- 新建 -->
<div id="createRepository"  style="display: none;">
	<form  class="form-horizontal" name="repositoryForm" role="form">
	<input type="hidden"  name="id"  id="rid"/>
	<input type="hidden"  name="proCategory.id"  id="pid" value="${(p.params['so_pid'])!}"/>
	  <div class="form-group">
	    <label for="title" >标题</label>
	      <input class="form-control" id="title"  name="title" required />
	  </div>
	  <div class="form-group">
	    <div style="text-align: center;" >
	      <button  onclick="sub(this);"  type="button" class="btn btn-info">提交</button>
	    </div>
	  </div>
	</form>
</div>

<script type="text/javascript">
		$(".check_all").click(function(){
			if(this.checked){
				$(".retbody input[type='checkbox']").prop("checked" , true);
			}else{
				$(".retbody input[type='checkbox']").prop("checked" , false);
			}
		});

		function search() {
            $.messager.progress({
                text : "loadding",
                interval : 100
            });
            $("#center").load('/content/v_list.do' , $("form[id='soform']").serialize() , function(){
                $.messager.progress('close');
            });
		}
		
		function deleteMore(){
			if($(".retbody input[type='checkbox']:checked").length > 0){
				var ids = [];
				$(".retbody input[type='checkbox']:checked").each(function(){
					ids.push($(this).attr("_rep"));
				});
				artDialog.confirm('是否确认批量删除' , function(){
					$.ajax({
						url : '/content/o_delete_more.do',
						type : 'post',
						dataType : 'json',
						data : {ids : ids.join(",")},
						success : function(data){
							if(data.success){
					               refeshthis();
								}else{
								   artDialog.alert(data.msg , function(){refeshthis();});
								}
						}
					});
				});
			}else{
				artDialog.alert("请选择" , function(){});
			}
		}

		function refeshthis(){
			$.messager.progress({
				text : "loadding",
				interval : 100
			});
			$("#center").load('/content/v_list.do' , $("form[id='contentForm']").serialize() , function(){
				$.messager.progress('close');
			});
		}
		
		function contentgo(pageNo){
			$("#contentForm input[name='pageNo']").val(pageNo);
			refeshthis();
		}
		function contentrefresh(){
			contentgo(${p.pageNo});
		}
		
		
	function addRole(){
		$("#center").load('/content/v_add.do?channelId=${so_channelId}&preview=${RequestParameters['preview']!}' , function(){
		});
	}

	function edit(id){
		$("#center").load('/content/v_add.do?channelId=${so_channelId}&id='+id + '&preview=${RequestParameters['preview']!}', function(){
		});
	}

	function del(id){
		artDialog.confirm('是否确认删除' , function(){
				$.ajax({
					url : '/content/o_del.do',
					type : 'post',
					dataType : 'json',
					data : {
						id : id
					},
					beforeSend:function(){
			            //art.dialog.tips("删除中...");
			        },
					success : function(data){
						if(data.success){
							refeshthis();
						}else{
							artDialog.alert(data.msg , function(){refeshthis();});
						}
					}
				});
			});
	}
</script>
